package cn.com.infostrategy.ui.mdata.formatcomp;

import java.util.Stack;

import org.nfunk.jep.ParseException;
import org.nfunk.jep.function.PostfixMathCommand;

import cn.com.infostrategy.ui.mdata.BillFormatPanel;
import cn.com.infostrategy.ui.report.chart.BillChartPanel;

public class GetBillChartRealPanel extends PostfixMathCommand {

	private BillFormatPanel formatpanel = null; //

	public GetBillChartRealPanel(BillFormatPanel _billcellpanel) {
		this.formatpanel = _billcellpanel; //
		numberOfParameters = 5; //
	}

	public void run(Stack inStack) throws ParseException {
		Object param_1 = inStack.pop();
		Object param_2 = inStack.pop();
		Object param_3 = inStack.pop();
		Object param_4 = inStack.pop();
		Object param_5 = inStack.pop();

		String str_title = (String) param_5;
		String str_xlabel = (String) param_4;
		String str_ylabel = (String) param_3;
		String str_sql = (String) param_2;
		String bool = (String) param_1;
		if (bool.equals("false")) {
			BillChartPanel chartPanel = BillChartPanel.getChartPanelBySQL(
					str_title, str_xlabel, str_ylabel, str_sql, false); //

			String _returnkey = "billchart_" + formatpanel.getCompentSeq(); //
			formatpanel.getPanelMap().put(_returnkey, chartPanel); // //
			inStack.push(_returnkey); //

		} else {
			BillChartPanel chartPanel = BillChartPanel.getChartPanelBySQL(
					str_title, str_xlabel, str_ylabel, str_sql, true); //

			String _returnkey = "billchart_" + formatpanel.getCompentSeq(); //
			formatpanel.getPanelMap().put(_returnkey, chartPanel); // //
			inStack.push(_returnkey); //

		}
	}

}
